<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <%@taglib prefix="import" uri="/WEB-INF/tld/importTag.tld" %>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>
<%@taglib prefix="mu" uri="/WEB-INF/tld/mallutil.tld" %>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<style>
.bg-gy th{
background:#f3f3f3;
}
</style>
<import:around enableCache="false" url="qaa/cs/record?memberId=${mu:memberId()}" appendParameter="memberId,questionId">
<script>
$(function(){
	$('#current_location').html(' > 客服问答');
});
</script>
<%--
${pu:reqSet('member', pu:get('com.yaodian100.ec.member.entity.Member', mu.memberId())) }
--%>
${pu:reqSet('quest', pu:get('com.yaodian100.crm.cs.entity.Question', param.questionId)) }
<c-rt:if test="${empty quest.extraValue['productId'].value && empty quest.extraValue['orderId'].value}">
${pu:listAdd('params', param.questionId) }
${pu:listAdd('params', mu:memberId())}
${pu:reqSet('questions', pu:queryByHql('from Question where id=? and memberId=?', pu:arrayGet('params'), null)) }
</c-rt:if>
<c-rt:if test="${!empty quest.extraValue['productId'].value}">
${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', quest.extraValue['productId'].value)) }
</c-rt:if>
<c-rt:if test="${!empty quest.extraValue['orderId'].value}">
${pu:reqSet('qHql', 'from Question q where (q.extraValue[\'orderId\'].value is not null and q.extraValue[\'orderId\'].value=? and q.extraValue[\'isProductQAA\'].value=?) and q.memberId=? order by q.createDate desc')  }
${pu:listAdd('params', quest.extraValue['orderId'].value) }
${pu:listAdd('params', 'false') }
${pu:listAdd('params', mu:memberId())}
${pu:reqSet('questions', pu:queryByHql(qHql, pu:arrayGet('params'), null)) }
</c-rt:if>
<c-rt:if test="${empty quest.extraValue['orderId'].value && !empty question.extraValue['productId'].value}">
${pu:reqSet('qHql', 'from Question q where (q.extraValue[\'productId\'].value is not null and q.extraValue[\'productId\'].value=? and q.extraValue[\'isProductQAA\'].value=?) and q.memberId=? order by q.createDate desc')  }
${pu:listAdd('params', quest.extraValue['productId'].value) }
${pu:listAdd('params', 'false') }
${pu:listAdd('params', mu:memberId())}
${pu:reqSet('questions', pu:queryByHql(qHql, pu:arrayGet('params'), null)) }
</c-rt:if>
<!-- content start --> 
  <div class="content mb-od"> 
    <!-- 我要询问 --> 
    <h2>问答记录</h2> 
    <h3>订单资料</h3> 
${pu:reqSet('memberId', mu:memberId())}
<c-rt:if test="${quest.memberId eq memberId}">
<table class="tb-2-service"> 
  <tr> 
    <th>用户名：</th> 
    <td>
    ${pu:reqSet('memberHql', 'select loginId from Member where memberId=?')}
    ${pu:listAdd('memberList', mu:memberId())}
    ${pu:queryByHql(memberHql, pu:arrayGet('memberList'), null)[0] }</td> 
    <th>邮箱：</th> 
    <td>${quest.email }</td> 
  </tr> 
  <tr> 
    <th>订单编号：</th> 
    <td><a href="<c-rt:url value="/member/order/page.do?page=detail&orderId=${quest.extraValue['orderId'].value }"/>">${quest.extraValue['orderId'].value }</a></td> 
    <th>商品名称：</th> 
    <td><a href="<c-rt:url value="/product/product.do?productId=${quest.extraValue['productId'].value }"/>">${product.productName }</a></td> 
  </tr> 
  <tr> 
    <th>固定电话：</th> 
    <td>
    <c-rt:if test="${! empty quest.extraValue['phone'].value && quest.extraValue['phone'].value!=' ' }">
    ${quest.extraValue['phoneArea'].value } ${quest.extraValue['phone'].value } 分机${quest.extraValue['phoneExt'].value }
    </c-rt:if>
    </td> 
    
    <th>手机：</th> 
    <td>${quest.extraValue['cellPhone'].value }</td> 
  </tr> 
</table> 
 <h3>问答记录 <span class="txt-ask"><a href="<c-rt:url value="/member/cs/page.do?page=request&questionId=${quest.id }&orderId=${quest.extraValue['orderId'].value }&productId=${quest.extraValue['productId'].value }"/>">  我要询问</a></span></h3> 
</c-rt:if>

<c-rt:forEach items="${questions }" var="question" varStatus="status">
<table class="tb-2-service <c-rt:if test="${status.index%2==1 }">bg-gy</c-rt:if>"> 
  <tr> 
    <th>问题编号：</th> 
    <td>${question.id }</td> 
    <th>提问日期：</th> 
    <td> <fmt-rt:formatDate value="${question.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td> 
    <th>问题类别：</th> 
    <td>
    <c-rt:if test="${!empty question.extraValue['class2'].value}">
	${pu:reqSet('cqt', pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['class2'].value)) }
	${cqt.name }
	</c-rt:if>
	</td> 
    </tr> 
  <tr> 
    <th>提问内容：</th> 
    <td colspan="5">${question.description }</td> 
    </tr> 
    <c-rt:if test="${!empty question.answer}">
  <tr> 
    <th>客服回复：</th> 
    <td colspan="5"> 
    <c-rt:forEach items="${question.answers}" var="answer">
    <c-rt:if test="${answer.isApproved!=false}">
    <p>回复时间：<span class="txt-rd"><fmt-rt:formatDate value="${answer.createDate}" pattern="yyyy/MM/dd HH:mm:ss"/></span></p> 

	${answer.content }
	</c-rt:if>
	<c-rt:if test="${answer.isApproved==false}">
    <p>正在回复中</p> 

	</c-rt:if>
	</c-rt:forEach>
</td> 
    </tr> 
    </c-rt:if>
</table> 
</c-rt:forEach>
    </div> 
  <!-- content end --> 
</import:around>